<template>
  <!-- 工单统计 -->
  <!-- <el-container> -->
  <el-main id="workOrder">
    <el-button
      type="primary"
      class="fullscreen"
      @click="setFullscreen"
      v-if="isShow"
      >全屏</el-button
    >
    <div class="top-title">工单数据统计看板</div>
    <div class="top-info">
      <img
        :src="require('/public/img/workOrder/logo.webp')"
        alt=""
        class="logo"
      />
      <div class="left">
        <p class="time">{{ time }}</p>
        <p class="date">
          {{ $TOOL.dateFormat(new Date(), "yyyy-MM-dd") }}
          {{ $TOOL.getLunar() }}
        </p>
      </div>
    </div>
    <div class="main">
      <div class="centerBox">
        <!-- 设备运行时长 -->
        <running-time></running-time>
        <!-- 中间统计部分 -->
        <count></count>
        <!-- 实时工单列表 -->
        <work-order-list></work-order-list>
      </div>
      <div class="bottomBox">
        <running-state></running-state>
      </div>
    </div>
    <img
      :src="require('/public/img/workOrder/top.webp')"
      alt=""
      class="bg-top"
    />
    <img
      :src="require('/public/img/workOrder/left.webp')"
      alt=""
      class="bg-left"
    />
    <img
      :src="require('/public/img/workOrder/right.webp')"
      alt=""
      class="bg-right"
    />
    <img
      :src="require('/public/img/workOrder/bottom.webp')"
      alt=""
      class="bg-bottom"
    />
    <img
      :src="require('/public/img/workOrder/bottom.webp')"
      alt=""
      class="bg-bottom"
    />
  </el-main>
  <!-- </el-container> -->
</template>
<script>
import runningTime from './components/runningTime.vue'
import count from './components/count.vue'
import workOrderList from './components/workOrderList.vue'
import runningState from './components/runningState.vue'
export default {
  name: 'workOrder',
  components: {
    runningTime,
    count,
    workOrderList,
    runningState
  },
  data () {
    return {
      time: '',
      timer: null,
      isShow: true,

    }
  },
  mounted () {
    if (this.$route.query.full) {
      this.isShow = false
    }
    this.showTime()
    this.timer = setInterval(() => {
      this.showTime()
    }, 1000)
  },
  methods: {

    showTime () {
      this.time = this.$TOOL.dateFormat(new Date(), 'hh:mm:ss')
    },
    // 设置全屏
    setFullscreen () {
      let url = this.$router.resolve({ path: '/work_order', query: { full: true } })
      window.open(url.href, '_blank')

    }
  },
  beforeDestroy () {
    clearInterval(this.timer)
  },
}
</script>
<style lang="scss" scoped>
#workOrder {
  position: relative;
  width: 100%;
  height: 100%;
  padding: 0;
  background: url("/public/img/workOrder/bg.webp") no-repeat;
  background-size: 100% 100%;
  .top-title {
    position: absolute;
    top: 35px;
    left: 50%;
    transform: translateX(-50%);
    letter-spacing: 7px;
    text-shadow: -1px -1px 0 #f8fdff, 0 4px 4px rgba(0, 0, 0, 0.25);
    font-size: 42px;
    font-weight: 600;
    color: #d3e6ff;
    z-index: 2;
  }
  .bg-top {
    position: absolute;
    width: 100%;
    top: 0;
    left: 0;
    z-index: 1;
  }
  .top-info {
    display: flex;
    justify-content: space-between;
    padding: 50px 30px 0 50px;
    color: #fff;
    .logo {
      width: 200px;
    }
    .left {
      display: flex;
      flex-direction: column;
      align-items: flex-end;
    }
    .time {
      font-size: 16px;
      font-weight: 600;
    }
  }
  .main {
    position: relative;
    padding: 60px 60px 30px 60px;
    width: 100%;
    height: calc(100% - 100px);
    color: #fff;
    box-sizing: border-box;
    z-index: 99;
  }
  .centerBox {
    height: 67%;
    display: flex;
  }
  .bottomBox {
    height: 33%;
    padding-top: 50px;
    overflow: auto;
    box-sizing: border-box;
  }
  :deep(.title) {
    padding: 3px 0 0 10px;
    height: 31px;
    width: 422px;
    background: url("/public/img/workOrder/title_sub.webp") no-repeat;
    background-size: 100% 100%;
    font-size: 18px;
  }

  .text-shadow {
    text-shadow: 1px 1px 0px rgba(0, 0, 0, 0.8);
  }
  .bg-left {
    position: absolute;
    width: 45px;
    top: 150px;
    left: 0;
  }
  .bg-right {
    position: absolute;
    width: 45px;
    top: 150px;
    right: 0;
  }
  .bg-bottom {
    position: absolute;
    width: 100%;
    // left: 0;
    bottom: 0;
  }
  .fullscreen {
    position: absolute;
    // bottom: 50px;
    top: 10px;
    right: 0;
    z-index: 999;
  }
}
</style>